package com.gaussic.repository;

import com.gaussic.model.UsersEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
@Repository
public interface UsersRepository extends JpaRepository<UsersEntity, Integer> {

    // 修改博文操作
    @Modifying
    @Transactional
    @Query("update UsersEntity US set US.name=:qName, US.sex=:qSex , US.address=:qAddress, US.phone=:qPhone," +
            " US.birth=:qBirth,US.signupStatus=:qSignupStatus,US.signupAt=:qSignupAt,US.ciscId=:qCiscId,US.committeeId=:qCommitteeId,US.password=:qPassword where US.id=:qId")
    void updateUsers(@Param("qName") String name, @Param("qSex") boolean sex, @Param("qAddress") String address, @Param("qPhone") String phone,
                    @Param("qBirth") Date birth,@Param("qSignupStatus") boolean signupStatus,@Param("qSignupAt") Date signupAt,@Param("qCiscId") int ciscId,@Param("qCommitteeId") int committeeId,@Param("qPassword") String password ,@Param("qId") int id);
}
